<template>
  <div>
  用户名<input type="text" v-model='form.username'>
    密码<input type="text" v-model='form.password'>
    <button @click='login'>登录</button>

    </div>
</template>
<script>
  export default {
    data(){
      return{
        form:{}
      }
    },
    methods: {
      login(){
        this.axios.post('users/teacherLogin/',this.form)
          .then(res=>{
          if(res.data.code == 200){
            localStorage.setItem('tuserid',res.data.tid)
            localStorage.setItem('tusername',res.data.tname)
            this.$router.push({path:'/show'})
          }
        })
      }
    },
  }
  </script>
  <style lang="">

  </style>
